﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;

namespace pos
{
    

    public partial class FlashForm : Form
    {

        [DllImport("User32.dll")]
        public static extern int GetSystemMenu(int hWnd, int bRevert);
        [DllImport("User32.dll")]
        public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags);   

        public FlashForm()
        {
            InitializeComponent();
        }
        public void ThreadFunction()
        {
            //  form = new FlashForm();
            //  Application.Run(form);  
            pos.entity.SpringContext.init();
            CloseIt();

        }
        private void FlashForm_Load(object sender, EventArgs e)
        {
            Thread thread;
            thread = new Thread(ThreadFunction);
          //  thread.IsBackground = true;
            thread.Start();




        //    timer1.Start();
                    int   lSysMenu;   
                     const   int     MF_BYPOSITION   =   1024;   
                    lSysMenu   =   GetSystemMenu(this.Handle.ToInt32(),   0);   
                    RemoveMenu(lSysMenu,   6,   MF_BYPOSITION);   
        }
        public delegate void  DCT();
        public void CloseIt()
        {
            if (this.InvokeRequired)
            {
                DCT d = CloseIt;
                this.Invoke(d, new object[] { });
            }
            else
            {
                this.Hide();
                this.Close();
            }
           
        }

       
    }
}
